package cn.learn.controller.stat;

import cn.learn.base.BaseController;
import cn.learn.service.stat.StatService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/stat")
public class StatController extends BaseController {

    @Reference
    private StatService statService;

    /**
     * 跳转到对应的页面
     * @param chartsType
     * @return
     */
    @RequestMapping("/toCharts")
    private String toCharts(String chartsType) {
        return "/stat/stat-" + chartsType;
    }

    @RequestMapping(value = "/getFactoryData",name = "厂商货物的销售总金额")
    @ResponseBody // [{},{}]
    public List getFactoryData(){
        List<Map> list = statService.getFactoryData(companyId);
        return list;
    }

    @RequestMapping(value = "/getSellData",name = "货物销售总金额前15名")
    @ResponseBody // [{},{}]
    public List getSellData(){
        List<Map> list=statService.getSellData(companyId);
        return list;
    }


    @RequestMapping(value = "/getonlineData",name = "系统访问压力数据")
    @ResponseBody // [{},{}]
    public List getonlineData(){
        List<Map> list=statService.getonlineData(companyId);
        return list;
    }

    @RequestMapping(value = "/getLoginData",name = "登录ip次数排行")
    @ResponseBody // [{},{}]
    public List getLoginData(){
        List<Map> list=statService.getLoginData(companyId);
        return list;
    }

    @RequestMapping(value = "/getPriceData",name = "市场产品最高价排行")
    @ResponseBody // [{},{}]
    public List getPriceData(){
        List<Map> list=statService.getPriceData(companyId);
        return list;
    }
}
